<template>
  <view>
    <scroll-view  scroll-y="true" class="scroll-Y" >
      <view class="u-flex flex_bt record" v-for="data in list" :key="data.price">
        <view>
          <view class="name" v-if="data.pay_type == 1">提现到富友</view>
          <view class="name" v-else>提现到微信</view>
          <view class="time">{{data.createtime}}</view>
        </view>
        <view class="price">
         -{{data.price}} 元
        </view>
      </view>
      <view class="loading_text">
        <text>{{loadingText}}</text>
      </view>
    </scroll-view>
  </view>
</template>

<script>
export default {
  name: "Withdrawal",
  data(){
    return{
      loadingText:'',
      allpage:'',
      page:1,
      list:[],
    }
  },
  onLoad(){
    this.setData()
  },
  methods:{
    setData(){
      let that = this
      let form = {
        limit:10,
        page:this.page || 1
      }
      this.$api.WithdrawList(form).then(res => {
        this.allpage = res.data.list.last_page
        that.list = [...that.list,...res.data.list.data]
      })
    },
    //上拉加载
    onReachBottom(){
      if(this.page>=this.allpage){
        this.loadingText="已经到底啦！"
        return ;
      }else{
        this.loadingText = '加载中....'
      }
      this.page ++
      this.setData()
    },
  }
}
</script>

<style scoped lang="scss">
.record{
  height: 140rpx;
  width: 100%;
  padding: 0 30rpx;
  border-bottom: 2rpx solid $uni-border-color;
  background: white;
  &:last-child{
    border: 0;
  }
}
  .price{
    color: $uni-color-price;
    font-size: 32rpx;
  }
  .name{
    font-size: 28rpx;
    color: $uni-text-color;
  }
  .time{
    font-size: 20rpx;
    color: $uni-text-color-grey;
    margin-top: 8rpx;
  }
</style>